package com.fy56.platform.logistics.service.impl.common;

import com.fy56.platform.logistics.common.ResultModel;
import com.fy56.platform.logistics.mapper.CompanyMapper;
import com.fy56.platform.logistics.model.Company;
import com.fy56.platform.logistics.service.common.ISendmsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 推送消息Service
 *
 * @author li
 * @version 2018-03-15
 */
@Service
public class SendMsgServiceImpl implements ISendmsgService {

    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public ResultModel send(Map<String,Object> map){

        //根据金融代码获取企业信息
        Company model = companyMapper.selectByCode(map.get("tenant").toString());
        //判断该企业是否存在，是否开启推送功能，若开启了则发送货物跟踪消息
        if(model != null && model.getSendMsgFlag() == 1){

            //构建消息
            String msg = makeMessage(map);

            //发送消息
            sent(msg);

        }



        return ResultModel.ok();
    }

    private String makeMessage(Map<String,Object> map){
        return null;
    }

    private void sent(String msg){

    }

}
